package com.chenjun.controller;


import com.chenjun.domain.pojo.User;
import com.chenjun.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-09-23
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService service;

    @GetMapping("/login")
    public User login(@RequestParam(value = "name") String username,String pwd){
        return service.finByName(username);
    }

    @PostMapping ("/register")
    public void  register(@RequestBody User user){
        service.save(user);
    }


}
